<include file="Public:header" />
<load file="__ROOT__/js/datepick/jquery.datepick.css" />
<load file="__ROOT__/js/datepick/jquery.datepick.js" />
<load file="__ROOT__/js/datepick/jquery.datepick-zh-CN.js" />
<script type="text/javascript">
    $(function(){
        $("[name=user_name]").focus();
        $(document).ready(function(){
            $('#user_birthday').datepick({dateFormat: 'yy-mm-dd'});
            $('#user_ruzhi').datepick({dateFormat: 'yy-mm-dd'});
        });
        $('#b1').click(function(){
            if(check()){
                $("form:first").submit();
            }
        });

        function check(){
            if($('[name=user_name]').val()==''){
                $('#pop_username').html('请填写用户名！');
                $('[name=user_name]').focus();
                return false;
            }
            if($('[name=user_pwd]').val()==''){
                $('#pop_userpwd').html('请填写密码！');
                $('[name=user_pwd]').focus();
                return false;
            }
            if($('[name=user_no]').val()==''){
                $('#pop_userno').html('请填写员工工号！');
                $('[name=user_no]').focus();
                return false;
            }
            if($('[name=user_zsname]').val()==''){
                $('#pop_userzsname').html('请填写员工真实姓名！');
                $('[name=user_zsname]').focus();
                return false;
            }
            if($('[name=user_tel]').val()==''){
                $('#pop_usertel').html('请填写联系电话！');
                $('[name=user_tel]').focus();
                return false;
            }
            if($('[name=user_birthday]').val()==''){
                $('#pop_userb').html('请选择员工出生日期！');
                $('[name=user_birthday]').focus();
                return false;
            }
            if($('[name=user_ruzhi]').val()==''){
                $('#pop_userrz').html('请选择员工入职日期！');
                $('[name=user_ruzhi]').focus();
                return false;
            }
            return true;
        }
    });
</script>
<div class="body">
    <form method="post" name="save" action="{:U('user/save_newuser')}">
    <b>新建用户：</b><br /><br />
    <table width="400" border="1" cellpadding="0" cellspacing="0" style="border-collapse:collapse" bordercolor="#000000">
        <tr>
            <td width="30%" align="right">用户名：</td>
            <td width="70%"><div style="margin-left: 10px;"><input name="user_name" id="user_name" maxlength="20" type="text" size="15" /><span id="pop_username" style="color:red;"></span></div></td>
        </tr>
        <tr>
            <td width="30%" align="right">密码：</td>
            <td width="70%"><div style="margin-left: 10px;"><input name="user_pwd" id="user_pwd" maxlength="30" type="password" size="15" /><span id="pop_userpwd" style="color:red;"></span></div></td>
        </tr>
        <tr>
            <td width="30%" align="right">性别：</td>
            <td width="70%"><div style="margin-left: 10px;">
                    <select name="user_sex">
                        <option value="男">男</option>
                        <option value="女">女</option>
                    </select>
                </div></td>
        </tr>
        <tr>
            <td width="30%" align="right">员工工号：</td>
            <td width="70%"><div style="margin-left: 10px;"><input name="user_no" type="text" size="15" maxlength="5" /><span id="pop_userno" style="color:red;"></span></div></td>
        </tr>
        <tr>
            <td width="30%" align="right">真实姓名：</td>
            <td width="70%"><div style="margin-left: 10px;"><input name="user_zsname" type="text" size="15" maxlength="6" /><span id="pop_userzsname" style="color:red;"></span></div></td>
        </tr>
        <tr>
            <td width="30%" align="right">联系电话：</td>
            <td width="70%"><div style="margin-left: 10px;"><input name="user_tel" type="text" size="15" maxlength="11" /><span id="pop_usertel" style="color:red;"></span></div></td>
        </tr>
        <tr>
            <td width="30%" align="right">出生日期：</td>
            <td width="70%"><div style="margin-left: 10px;"><input name="user_birthday" style="cursor: pointer;" id="user_birthday" type="text" size="15" readonly /><span id="pop_userb" style="color:red;"></span></div></td>
        </tr>
        <tr>
            <td width="30%" align="right">入职日期：</td>
            <td width="70%"><div style="margin-left: 10px;"><input name="user_ruzhi" id="user_ruzhi" style="cursor: pointer;" type="text" size="15" readonly /><span id="pop_userrz" style="color:red;"></span></div></td>
        </tr>
        <tr>
            <td width="30%" align="right">禁止登录OA：</td>
            <td width="70%"><div style="margin-left: 10px;">
                    
                    <select name="login_disable">
                        <option value="n">否</option>
                        <option value="y">禁止</option>
                    </select>
                </div></td>
        </tr>
        <tr>
            <td width="30%" align="right">显示用户列表：</td>
            <td width="70%"><div style="margin-left: 10px;">
                    <select name="user_list">
                        <option value="y">显示</option>
                        <option value="n">不显示</option>
                    </select>
                </div></td>
        </tr>
        <tr>
            <td width="30%" align="right">禁止显示桌面：</td>
            <td width="70%"><div style="margin-left: 10px;">
                    <select name="explorer_disable">
                        <option value="n">否</option>
                        <option value="y">禁止</option>
                    </select>
                </div></td>
        </tr>
        <tr>
            <td width="30%" align="right">权限组：</td>
            <td width="70%">
                <div style="margin-left: 10px;">
                    <select name="qx_id">
                        <foreach name="qx_list" item="qx">
                            <option value="{$qx.qx_id}">{$qx.qx_name}</option>
                        </foreach>
                    </select>
                </div>
            </td>
        </tr>
        <tr>
            <td width="30%" align="right">所属部门：</td>
            <td width="70%"><div style="margin-left: 10px;">
                    
                    <select name="bm_id">
<!--        <foreach name="bm_list" item="vo">
            <option value="{$vo.bm_id}">{$vo.bm_name}</option>
        </foreach>-->
        <?php
         /**
     * 实验性无限级递归方法
     */
    function digui($bm_id){
        $Bumen=M('Bumen');
        $list=$Bumen->order('bm_px_no')->where('bm_main='.$bm_id)->select();
        
        foreach($list as $vo){
            echo '<option value="'.$vo['bm_id'].'">├'.$vo['bm_name'].'</option>';
            if($Bumen->where('bm_main='.$vo['bm_id'])->count()>0){
                digui($vo['bm_id']);
            }
        }
        unset($Bumen);
    }

    
        $Bumen=M('Bumen');
        $p_list=$Bumen->order('bm_px_no')->where("bm_main=0")->select();
        for($i=0;$i<count($p_list);$i++){
            echo '<option value="'.$p_list[$i]['bm_id'].'">├'.$p_list[$i]['bm_name'].'</option>';
            if($Bumen->where('bm_main='.$p_list[$i]['bm_id'])->count()>0){
                digui($p_list[$i]['bm_id']);
            }
        }
       unset($Bumen);
        ?>
    </select>
                </div></td>
        </tr>
        <tr>
            <td width="30%" style="text-align: right;">身份角色：</td>
            <td width="70%"><div style="margin-left: 10px;">
<!--                    <foreach name="shenfen_list" item="sf">
                        
                    </foreach>-->
                    <input type="checkbox" name="shenfen[]" value="z" />咨询师<br />
                    <input type="checkbox" name="shenfen[]" value="t" />教师<br />
                    <input type="checkbox" name="shenfen[]" value="s" />学管<br />
                    <input type="checkbox" name="shenfen[]" value="k" />教务<br />
                    
                </div></td>
        </tr>
        <tr>
            <td width="30%" style="text-align: right;">备注：</td>
            <td width="70%"><div style="margin-left: 10px;">
                    <textarea name="user_beizhu" cols="30" rows="4"></textarea>
                </div></td>
        </tr>
    </table>
    <div style="margin-left: 50px;margin-top: 10px;">
    <input value=" 保    存 " type="button" name="b1" id="b1" /></div>
    </form>
</div>
<include file="Public:ender" />